<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>16-数组索引</title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = ['red','orange','blue','red'];
			//indexOf('元素')  存在则返回索引不存在则返回-1
			console.log(arr.indexOf('red'));
			console.log(arr.indexOf('black'));
			//lastindexOf('元素') 元素最后一个出现的索引
			console.log(arr.lastIndexOf('red'));//3
		</script>
	</body>
</html>
